﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IrcServerNotConnectedException.cs" company="LeetSoftwerx">
//   Copyright ©2012 LeetSoftwerx
// </copyright>
// <summary>
//   The irc server not connected exception.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Irclib
{
    using System;
    using System.Runtime.Serialization;

    /// <summary>
    /// The irc server not connected exception.
    /// </summary>
    [Serializable]
    public sealed class IrcServerNotConnectedException : Exception
    {
        #region Constants and Fields

        /// <summary>
        /// The _server.
        /// </summary>
        private IrcConnection _server;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="IrcServerNotConnectedException"/> class. 
        /// Creates a new IrcServerNotConnectedException
        /// </summary>
        /// <param name="server">
        /// The server that is not connected 
        /// </param>
        public IrcServerNotConnectedException(IrcConnection server)
            : base()
        {
            this._server = server;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="IrcServerNotConnectedException"/> class. 
        /// Creates a new IrcServerNotConnecteException
        /// </summary>
        /// <param name="message">
        /// The message that describes the error. 
        /// </param>
        /// <param name="server">
        /// The server that is not connected 
        /// </param>
        public IrcServerNotConnectedException(string message, IrcConnection server)
            : base(message)
        {
            this._server = server;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="IrcServerNotConnectedException"/> class. 
        /// Creates a new IrcServerNotConnecteException
        /// </summary>
        /// <param name="message">
        /// The message that describes the error. 
        /// </param>
        /// <param name="innerException">
        /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. 
        /// </param>
        /// <param name="server">
        /// The server that is not connected 
        /// </param>
        public IrcServerNotConnectedException(string message, Exception innerException, IrcConnection server)
            : base(message, innerException)
        {
            this._server = server;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="IrcServerNotConnectedException"/> class. 
        /// The irc server not connected exception.
        /// </summary>
        /// <param name="info">
        /// The System.Runtime.Serialization.SerializationInfo that holds the serialized object data about the exception being thrown. 
        /// </param>
        /// <param name="context">
        /// The System.Runtime.Serialization.StreamingContext that contains contextual information about the source or destination. 
        /// </param>
        private IrcServerNotConnectedException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets Server.
        /// </summary>
        public IrcConnection Server
        {
            get
            {
                return this._server;
            }
        }

        #endregion
    }
}